<?php 

$form = str_replace("\"","'",$this->form);
$form = str_replace("\r\n","",$form);
$form = str_replace("\n","",$form);
?>

<div class="grid_12">

    <div class="box round first fullpage">

        <h2>Quản lý tài khoản</h2>

        <div class="block" style="position: relative;">

            <div class="message warning loading">

                <p>Loading...</p>

            </div>

            <form class="form-search" onsubmit="return false">

                <dl class="zend_form">

                    <dt class="search-field"><label>Tìm kiếm: </label></dt>

                    <dd class="search-field"><input type="text" name="keyword" class="searchkey" /></dd>

                    <dt class="search-field"><label></label></dt>

                    <dd class="search-field"><button class="btn-mini btn-black btn-check"><span></span></button></dd>

                </dl>

            </form>

            <div class="dataTables_wrapper">

                <!-- Vị tri load datat-->

            </div>  

            <br />

            <a href="<?=$this->url(array('module'=>"admin",'controller'=>"user",'action'=>"add"))?>" class="btn btn-black">Thêm mới</a>        

        </div>

    </div>

</div>

<div class="dialog-message" title="Thông báo" style="display: none;"></div>

<div class="dialog-form" title="Form thay đổi mật khẩu" style="display: none;">

    

</div>

<script>



var form = "<div class='message info'><?=$form?></div>";

$(function(){

    //Khởi tạo dữ liệu ban đầu

    var link = "<?=$this->url(array("module"=>"admin","controller"=>"user","action"=>"list"), null, true)?>";

    $(".loading").show();

    $.get(link,null,function(rdata){

        $(".dataTables_wrapper").html(rdata);

        $(".loading").fadeOut(1000);

    })

    

    // Tìm kiếm

    $(".search-field .btn-check").click(function(){

        var value = $(".searchkey").val();           

        data = {"filter_field":"username","filter_value":value};

        $(".loading").show();

        $.get(link,data,function(rdata){

            $(".dataTables_wrapper").html(rdata);

            $(".loading").fadeOut(1000);

        })

    })

    

})

</script>